﻿@using System.Data;
@using DTcms.Common;
@model DTcms.Model.BaseModel
@{
    var m = (DTcms.Model.article_category)Model.info["category"];
    var siteModel = (DTcms.Model.site_channel)Model.info["site_model"];
    ViewBag.Title = m.title + "-" + Model.site.name;
    ViewBag.Keywords = m.seo_keywords;
    ViewBag.Description = m.seo_description;
    string category_nav = Html.get_category_menu("news_list", m.id, ">");
}
@section HeaderContent{

}
<!--当前位置-->
<div class="section">
    <div class="location">
        <span>当前位置：</span>
        <a href="@Html.linkurl("index")">首页</a> &gt;
        <a href="@Html.linkurl("news")">新闻资讯</a>
        @Html.Raw(category_nav)
    </div>
</div>
<!--/当前位置-->

<div class="section clearfix">
    <!--/页面右边-->
    <div class="right-260">
        <div class="bg-wrap nobg">
            <div class="sidebar-box">
                <h4>资讯类别</h4>
                <ul class="navbar">
                    @{
                        var categoryList1 = Html.get_category_child_list(siteModel.name, 0, 0);
                        foreach (var cdr1 in categoryList1)
                        {
                            var categoryList2 = Html.get_category_child_list(siteModel.name, cdr1.id, 0);
                            <li>
                                <h5><a href="@Html.linkurl("news_list",cdr1.id)">@cdr1.title</a></h5>
                                <p>
                                    @foreach (var cdr2 in categoryList2)
                                    {
                                        <a href="@Html.linkurl("news_list",cdr2.id)" class="@(cdr2.id==m.id?"selected":"")">@cdr2.title</a>
                                    }
                                </p>
                            </li>
                        }
                    }
                </ul>
            </div>

            <div class="sidebar-box">
                <h4>图片新闻</h4>
                <ul class="side-img-list">
                    @{
                        DataTable redNews = Html.get_article_list(siteModel.name, 0, 4, "status=0 and is_red=1 and img_url<>''");
                        foreach (DataRow dr in redNews.Rows)
                        {
                            <li>
                                <div class="img-box">
                                    <img src="@dr["img_url"]" />
                                </div>
                                <div class="txt-box">
                                    <a href="@Html.linkurl("news_show",dr["id"])">@dr["title"]</a>
                                    <span>@Html.datetostr(dr["add_time"], "yyyy-MM-dd")</span>
                                </div>
                            </li>
                        }
                    }
                </ul>
            </div>

            <div class="sidebar-box">
                <h4>阅读排行</h4>
                <ul class="txt-list">
                    @{
                        DataTable hotNews = Html.get_article_list(siteModel.name, 0, 10, "status=0", "click desc,id desc");
                        foreach (DataRow hotdr in hotNews.Rows)
                        {
                            int hotdr__loop__id = hotNews.Rows.IndexOf(hotdr) + 1;
                            <li>
                                <label class="@(hotdr__loop__id<2?"hot":"")">@hotdr__loop__id</label>
                                <a href="@Html.linkurl("news_show",hotdr["id"])">@hotdr["title"]</a>
                            </li>
                        }
                    }
                </ul>
            </div>

        </div>
    </div>
    <!--/页面右边-->
    <!--页面左边-->
    <div class="left-auto">
        <div class="bg-wrap">
            <ul class="n-list" id="articlList">
                <!--取得一个分页DataTable-->
                @{
                    DataTable newsList = Html.get_article_list(siteModel.name, m.id, Model.pagesize, Model.page, "status=0", out Model.totalcount, out Model.pagelist, "news_list", m.id, "__id__");
                    if (Model.totalcount > 0)
                    {
                        foreach (DataRow dr in newsList.Rows)
                        {
                            <li>
                                <h2><a href="@Html.linkurl("news_show",dr["id"])">@dr["title"]</a></h2>
                                <div class="note">
                                    @if (dr["img_url"].ToString() != "")
                                    {
                                        <b><img src="@dr["img_url"]" /></b>
                                    }
                                    <p>@dr["zhaiyao"]</p>
                                    <div class="info">
                                        <span><i class="iconfont icon-date"></i>@dr["add_time"]</span>
                                        <span>
                                            <i class="iconfont icon-comment"></i>
                                            <span class="b_comment tg_chrnum_@dr["id"]" data-tgid="@dr["id"]">0</span>人评论
                                        </span>
                                        <span><i class="iconfont icon-view"></i>@dr["click"]次浏览</span>
                                    </div>
                                </div>
                            </li>
                        }
                    }
                    else
                    {
                        <div class="nodata">无符合条件的信息！</div>
                    }
                }
            </ul>
            <!--页码列表-->
            <div class="page-box">
                <div class="pageNavigation">@Html.Raw(Model.pagelist)</div>
            </div>
            <!--/页码列表-->
        </div>
    </div>
    <!--/页面左边-->
</div>
@section Scripts{
    <script type="text/javascript">
        layui.use(['myaspx'], function () {
            var os = layui.myaspx;
            $('#articlList').get_comment_num('.b_comment', '@Model.config.webpath', @siteModel.id);
        });
    </script>
}
